//********************************************/
// Creation History
// Company : HTHK
// Name    : DivisionProcess.java
// Function : Division Master
// By       : Miranda Lin
// Date     : 11-Aug-2004 CRLOG 1347
/*********************************************/


package admin.system.division;

import com.ffpc.sql.*;

import java.sql.*;
import java.util.Vector;

/**
 * A Class class.
 * <P>
 * @author HTHK
 */
public class DivisionProcess
{
    public static DivisionBean createBean()
    {
        return new Division();
    }

    public static int insert(Connection con, DivisionBean divisionBean)
      throws DataException
    {
        Division division = (Division)divisionBean;
        division.setConnection(con);
        return division.insert();
    }

    public static int update(Connection con, DivisionBean divisionBean)
      throws DataException
    {
        Division division = (Division)divisionBean;
        division.setConnection(con);
        return division.update();
    }

    public static int delete(Connection con, DivisionBean divisionBean)
      throws DataException
    {
        Division division = (Division)divisionBean;
        division.setConnection(con);
        return division.delete();
    }

    public static DivisionBean[] find(Connection con, DivisionBean divisionBean)
      throws DataException
    {
        Division division = (Division)divisionBean;
        BaseSqlCommand buc = new BaseSqlCommand(con);
        Vector rows = buc.find(division);
        DivisionBean[] beans = new Division[rows.size()];
        for (int i=0;i<rows.size();i++)
        {
            Division bean = new Division();
            bean.setColumns((Column[])rows.get(i));
            beans[i] = bean;
        }
        return beans;
    }
}


